



extract_spice_simplified.py file, right?
I think these commands will yield a flattened parasitic extracted netlist with a hierarchical layout as input.
It also turns off some of the backup processing that may speed things up. The short resistor directives adds a 0Ω resistor between shorted ports instead of dropping them. And the feedback save will save any extraction anomalies (text problems, etc.).
magic_commands = [
"drc off",
"gds drccheck off",
"undo disable",
"locking disable",
"crashbackups stop",
f"gds read {tcl_brace(temp_gds)}",
f"load {tcl_brace(top_cell)}",
"select top cell",
"port makeall",
"expand",
f"flatten {tcl_brace(top_cell)}_flat",
f"load {tcl_brace(top_cell)}_flat",
f"cellname delete {tcl_brace(top_cell)}",
f"cellname rename {tcl_brace(top_cell)}_flat {tcl_brace(top_cell)}",
"select top cell",
"ext2spice lvs",
"ext2spice rthresh 0",
"ext2spice merge conservative"
"ext2spice short resistor"
"extresist simplify on",
"extresist minres 100",
"extresist threshold 1000",
"extract do resistance",
"extract all",
"ext2spice extresist on",
"ext2spice resistor tee on",
"feedback save {tcl_brace(top_cell)}.pex.feedback.txt",
]
Haven't tested, just added some of the commands from my scripts and Tim's comments.


extract_spice_simplified.py file, right?
I think these commands will yield a flattened parasitic extracted netlist with a hierarchical layout as input.
It also turns off some of the backup processing that may speed things up. The short resistor directives adds a 0Ω resistor between shorted ports instead of dropping them. And the feedback save will save any extraction anomalies (text problems, etc.).
magic_commands = [
"drc off",
"gds drccheck off",
"undo disable",
"locking disable",
"crashbackups stop",
f"gds read {tcl_brace(temp_gds)}",
f"load {tcl_brace(top_cell)}",
"select top cell",
"port makeall",
"expand",
f"flatten {tcl_brace(top_cell)}_flat",
f"load {tcl_brace(top_cell)}_flat",
f"cellname delete {tcl_brace(top_cell)}",
f"cellname rename {tcl_brace(top_cell)}_flat {tcl_brace(top_cell)}",
"select top cell",
"ext2spice lvs",
"ext2spice rthresh 0",
"ext2spice merge conservative"
"ext2spice short resistor"
"extresist simplify on",
"extresist minres 100",
"extresist threshold 1000",
"extract do resistance",
"extract all",
"ext2spice extresist on",
"ext2spice resistor tee on",
"feedback save {tcl_brace(top_cell)}.pex.feedback.txt",
]
Haven't tested, just added some of the commands from my scripts and Tim's comments. 
drc off
crashbackups stop
gds drccheck off
undo disable
locking disable
gds flatten yes # flattens cells with less than 10 shapes
gds flatglob <cellname> # repeated for other larger cells to be flattened before extracting. Note: All subcells must be explicitly flattened too.
gds read <gdsfile>
load <cellname>
select top cell
expand
extract no all ;# clear all flags
extract do aliases
extract do local
extract unique
ext2spice lvs
ext2spice merge conservative ;# reduce parallel devices
ext2spice short resistor ;# keep both ports but connect them with a 0 ohm resistor
ext2spice -o <cellname>.gds.spice <cellname>.ext
feedback save <cellname>.feedback.txt
Fun fact: magic's default extraction connects virtual nets by name - disjoint nets with the same label are extracted as connected.
Use extract unique to automatically add a _uq* suffix to unconnected duplicate labels.

drc off
crashbackups stop
gds drccheck off
undo disable
locking disable
gds flatten yes # flattens cells with less than 10 shapes
gds flatglob <cellname> # repeated for other larger cells to be flattened before extracting. Note: All subcells must be explicitly flattened too.
gds read <gdsfile>
load <cellname>
select top cell
expand
extract no all ;# clear all flags
extract do aliases
extract do local
extract unique
ext2spice lvs
ext2spice merge conservative ;# reduce parallel devices
ext2spice short resistor ;# keep both ports but connect them with a 0 ohm resistor
ext2spice -o <cellname>.gds.spice <cellname>.ext
feedback save <cellname>.feedback.txt
Fun fact: magic's default extraction connects virtual nets by name - disjoint nets with the same label are extracted as connected.
Use extract unique to automatically add a _uq* suffix to unconnected duplicate labels. 
M1 = input(13, 0)
M1.data = M1.data.merged(true, 0).decompose_convex_to_region
M1.output(13, 0)

M1 = input(13, 0)
M1.data = M1.data.merged(true, 0).decompose_convex_to_region
M1.output(13, 0)